﻿using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;
using FwProject.ShoppingMall.EventAdvertising;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace FwProject.ShoppingMall.Com
{
    /// <summary>
    /// 商城广告
    /// </summary>
    [Table("shop_Ad")]
    public class ShopAd: FullAuditedEntity<Guid>, IPassivable
    {
        public const int MaxAdNameLength = 50;
        /// <summary>
        /// 广告名称
        /// </summary>
        [Required]
        [MaxLength(MaxAdNameLength)]
        public string AdName { get; set; }

        /// <summary>
        /// 图片logo
        /// </summary>
        [Required]
        public string PicLogo { get; set; }

        /// <summary>
        /// 图片打开的网页路径
        /// </summary>
        [Required]
        public string HttpUrl { get; set; }

        #region IPassivable
        /// <summary>
        /// 是否激活（实现IPassivable接口）
        /// </summary>
        public bool IsActive { get; set; } = true;
        #endregion

        /// <summary>
        /// 广告详细内容
        /// </summary>
        public string ContentDetails { get; set; }

        /// <summary>
        /// 广告类型
        /// </summary>
        public AdType AdType { get; set; } = AdType.网页;

        /// <summary>
        /// json来源
        /// </summary>
        public string JsonSource { get; set; }

        /// <summary>
        /// 广告开始时间
        /// </summary>
        public DateTime AdbeginTime { get; set; }

        /// <summary>
        /// 广告结束时间
        /// </summary>
        public DateTime AdEndTime { get; set; }

        /// <summary>
        /// 收取费用
        /// </summary>
        public decimal Charge { get; set; } = 0m;

        /// <summary>
        /// 广告显示的位置
        /// </summary>
        public Guid AdFlag { get; set; }

        [ForeignKey("AdFlag")]
        public virtual ShopAdLocation ShopAdLocation { get; set; }
    }

    public enum AdType : byte
    {
        [Display(Name = "网页")]
        网页,
        [Display(Name = "内部网页")]
        内部网页,
        [Display(Name = "内部指定界面")]
        内部指定界面,
        [Display(Name = "明细页")]
        明细页
    }


}
